home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_100 / 172_01 / lmovb.c < prev    next >
Text File  |  1980-01-01  |  2KB  |  51 lines

  1. /*
  2.   HEADER:              CUG  nnn.nn;
  3.   TITLE:               LEX - A Lexical Analyser Generator
  4.   VERSION:             1.1 for IBM-PC
  5.   DATE:                Jan 30, 1985
  6.   DESCRIPTION:         A Lexical Analyser Generator. From UNIX
  7.   KEYWORDS:            Lexical Analyser Generator YACC C PREP
  8.   SYSTEM:              IBM-PC and Compatiables
  9.   FILENAME:            LMOVB.C
  10.   WARNINGS:            This program is not for the casual user. It will
  11.                        be useful primarily to expert developers.
  12.   CRC:                 N/A
  13.   SEE-ALSO:            YACC and PREP
  14.   AUTHORS:             Charles H. Forsyth
  15.                        Scott Guthery 11100 leafwood lane Austin, TX 78750
  16.                        Andrew M. Ward, Jr.  Houston, Texas (Modifications)
  17.   COMPILERS:           LATTICE C
  18.   REFERENCES:          UNIX Systems Manuals -- Lex Manual on distribution disks
  19. */
  20.  
  21. #include "lex.h"
  22.  
  23. #ifndef CMASK
  24. #define CMASK 0377
  25. #endif
  26.  
  27. _lmovb(lp, c, st)
  28. int c, st;
  29. struct lextab *lp;
  30. {
  31.     int base;
  32.  
  33.     while ((base = lp->llbase[st]+c) > lp->llnxtmax ||
  34.             (lp->llcheck[base] & CMASK) != st) {
  35.  
  36.         if (st != lp->llendst) {
  37. /*
  38.  * This miscompiled on Decus C many years ago:
  39.  *                      st = lp->lldefault[st] & CMASK;
  40.  */
  41.             base = lp->lldefault[st] & CMASK;
  42.             st = base;
  43.         }
  44.         else
  45.                         return(-1);
  46.         }
  47.         return(lp->llnext[base]&CMASK);
  48. }
  49.  
  50.  
  51.